package ooday04;
import java.util.Timer;
import java.util.TimerTask;

public class TimerDemo {
    public static void main(String[] args) {
        Timer timer=new Timer();
        int interval=1000;
        timer.schedule(new TimerTask() {
            @Override
            public void run(){
                System.out.println("认真学习");
            }
        },interval,interval);




        Timer timer1=new Timer();
        int interval1=1000;
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("儿童");
            }
        },interval1,interval1);















     /* Timer timer=new Timer();//定时器对象
      int interval=1000;//定时间隔（以毫秒为单位）
      timer.schedule(new TimerTask() {

          public void run() {
              System.out.println("刘思甜该吃饭了");
          }
      }, interval ,interval);*/
    }
}
